<?php
//活动管理
namespace app\adminbackstage\model;

use think\Model;
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class Parameter extends Model{
    protected $type = [

    ];
    // 模型初始化
    protected static function init()
    {
        parent::init();
        //TODO:初始化内容
    }
    
    
    //活动列表
    public function listParameter($page=1,$num=10,$where){
        $list = $this::name('parameter')
        ->field('id,p_name,p_value,addtime,enable')
        ->where($where)
        ->limit(($page-1)*$num,$num)
        ->select();
        return $list;
   
    }

    //活动数
    public function countParameter($where) {
        $list = $this::name('parameter')
        ->where($where)
        ->paginate();
        $count = $list->total();
        return $count;
    }
    
    public function infoParameter($where){
        $info = $this::name('parameter')
 
        ->where($where)
        ->find();
        return $info;
    }
    
    public function updateParameter($id,$update) {
        $in = $this::update($update, ['id' => $id]);
    }
    

  
}
